package com.governtalk.backend.repository;

import com.governtalk.backend.entity.Comment;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
    
    Page<Comment> findByPostIdAndStatus(Long postId, Comment.CommentStatus status, Pageable pageable);
    
    List<Comment> findByPostIdAndParentIdIsNullAndStatus(Long postId, Comment.CommentStatus status);
    
    Page<Comment> findByParentIdAndStatus(Long parentId, Comment.CommentStatus status, Pageable pageable);
    
    Page<Comment> findByUserId(Long userId, Pageable pageable);
}
